/*
 * Copyright (c) 2024 Huawei Technologies Co., Ltd.
 * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
 * CANN Open Software License Agreement Version 2.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */
#include <cmath>
#include "tiling_91093.h"
#include "tiling_func.h"

namespace Lcal {
    constexpr int32_t ALLGATHERV2_91093_EIGHT_RANK_FP16_PVALUE_DEFAULT = 6;
    constexpr int32_t ALLGATHERV2_91093_EIGHT_RANK_FP16_M0_DEFAULT = 128;
    constexpr int32_t ALLGATHERV2_91093_EIGHT_RANK_FP16_UBMOVENUM_DEFAULT = 190;
    constexpr int32_t ALLGATHERV2_91093_EIGHT_RANK_FP16_COMMDATASPLIT_DEFAULT = 16;
    constexpr int32_t ALLGATHERV2_91093_SIXTEEN_RANK_FP16_M0_DEFAULT = 128;
    constexpr int32_t ALLGATHERV2_91093_SIXTEEN_RANK_FP16_UBMOVENUM_DEFAULT = 160;
    constexpr int32_t ALLGATHERV2_91093_SIXTEEN_RANK_FP16_COMMNPUSPLIT_DEFAULT = 16;
    constexpr int32_t ALLGATHERV2_91093_SIXTEEN_RANK_FP16_PVALUE_DEFAULT = 12;
    constexpr int32_t ALLGATHERV2_91093_TWO_RANK_FP16_UBMOVENUM_DEFAULT = 12;
    constexpr int32_t ALLGATHERV2_91093_TWO_RANK_FP16_M0_DEFAULT = 128;
    constexpr int32_t ALLGATHERV2_91093_TWO_RANK_FP16_PVALUE_DEFAULT = 14;

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093EightRankFP16CommdatasplitMap = {
        {8,
         {{-1, 1518, -1, 2147483647, -1, 1624}, {-1, 1518, -1, 4608, 1880, 2274},
          {-1, 1518, 4608, 2147483647, 1624, 2274}, {1518, 8600, -1, 2147483647, -1, 1200},
          {8600, 8958, 10494, 2147483647, -1, 2274}, {8958, 2147483647, -1, 2147483647, -1, 2274},
          {-1, 2147483647, -1, 768, 2912, 5660}}},
        {16,
         {{-1, 1518, -1, 4608, 1624, 1880}, {1518, 8600, -1, 2147483647, 1200, 2274},
          {8600, 8958, -1, 10494, -1, 2274}, {-1, 2147483647, -1, 2147483647, 2274, 2912},
          {-1, 2147483647, -1, 768, 5660, 6450}, {-1, 2147483647, 768, 2147483647, 2912, 6450},
          {-1, 2147483647, -1, 2147483647, 6450, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093EightRankFP16UbmovenumMap = {
        {160,
         {{-1, 6950, -1, 2560, -1, 576}, {-1, 6950, -1, 2560, 832, 1200},
          {1262, 6950, -1, 1774, 1200, 2274}, {6950, 2147483647, -1, 2274, -1, 1536},
          {8858, 9728, -1, 2274, 1536, 2274}, {-1, 2147483647, -1, 768, 2912, 4608},
          {-1, 8720, -1, 768, 4608, 5312}}},
        {8,
         {{-1, 6950, 2560, 2147483647, -1, 576}, {-1, 6950, -1, 2147483647, 576, 832},
          {-1, 6950, 2560, 2147483647, 832, 1200}, {-1, 1262, -1, 2147483647, 1200, 2274},
          {1262, 6950, 3798, 2147483647, 1200, 2274}, {6950, 2147483647, 2274, 2147483647, -1, 768},
          {6950, 9728, 2274, 2147483647, 768, 1262}, {6950, 2147483647, 4810, 2147483647, 1262, 2274}}},
        {2,
         {{1262, 6950, 1774, 3798, 1200, 2274}, {6950, 8858, -1, 2274, 1536, 2274},
          {9728, 2147483647, 1280, 2274, 1536, 2274}, {6950, 2147483647, 2274, 4810, 1262, 1774},
          {-1, 2147483647, -1, 2147483647, 2274, 2912}, {8720, 2147483647, -1, 768, 4608, 5312},
          {-1, 2147483647, 768, 2147483647, 2912, 5312}, {-1, 2147483647, -1, 2147483647, 5312, 8446},
          {-1, 9728, -1, 2147483647, 8446, 10720}, {9728, 2147483647, -1, 9728, 8446, 10720},
          {-1, 2147483647, -1, 2147483647, 10720, 2147483647}}},
        {190,
         {{9728, 2147483647, -1, 1280, 1536, 2274}}},
        {20,
         {{9728, 2147483647, 2274, 2147483647, 768, 1262}}},
        {3,
         {{6950, 2147483647, 2274, 4810, 1774, 2274}, {9728, 2147483647, 9728, 2147483647, 8446, 10720}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093EightRankFP16M0Map = {
        {128,
         {{-1, 4810, -1, 2147483647, -1, 832}, {-1, 4810, -1, 768, 1536, 2274},
          {-1, 4810, 768, 2147483647, 832, 2274}, {4810, 2147483647, -1, 2147483647, -1, 2274},
          {-1, 2147483647, -1, 2274, 2274, 5660}, {-1, 2147483647, 2274, 6950, 2274, 5360},
          {-1, 2147483647, 6950, 7450, 2274, 5660}, {-1, 2147483647, 7450, 2147483647, 2274, 6934},
          {-1, 2147483647, -1, 2274, 6934, 2147483647}, {-1, 2147483647, 2274, 2786, 9470, 2147483647},
          {-1, 2147483647, 2786, 2147483647, 6934, 2147483647}}},
        {256,
         {{-1, 4810, -1, 768, 832, 1536}, {-1, 2147483647, -1, 2274, 5660, 6934},
          {-1, 2147483647, 2274, 6950, 5360, 6934}, {-1, 2147483647, 6950, 7450, 5660, 6934},
          {-1, 2147483647, 2274, 2786, 6934, 9470}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093EightRankFP16PvalueMap = {
        {1,
         {{-1, 1774, -1, 2147483647, -1, 576}, {-1, 1262, -1, 2147483647, 576, 2274},
          {-1, 2147483647, -1, 2274, 5660, 6934}, {-1, 2147483647, 2274, 2147483647, 2274, 6934},
          {-1, 2147483647, 1774, 5900, 6934, 2147483647}}},
        {4,
         {{1774, 2786, -1, 2147483647, -1, 576}, {2786, 5660, -1, 2274, -1, 2274},
          {2786, 2147483647, 2274, 2147483647, 768, 2274}, {-1, 2147483647, 5900, 2147483647, 6934, 2147483647}}},
        {2,
         {{1262, 2786, -1, 2147483647, 576, 2274}, {2786, 2147483647, 2274, 2147483647, -1, 768},
          {-1, 2147483647, -1, 2274, 2274, 5660}, {-1, 2147483647, -1, 1774, 6934, 2147483647}}},
        {6,
         {{5660, 2147483647, -1, 2274, -1, 2274}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093SixteenRankFP16PvalueMap = {
        {4,
         {{-1, 2786, -1, 768, -1, 768}, {-1, 2786, -1, 768, 1984, 2274},
          {4608, 6700, -1, 768, -1, 2274}, {3798, 4298, -1, 1006, 2274, 5312},
          {4298, 2147483647, -1, 1262, 2274, 4608}}},
        {2,
         {{-1, 2786, -1, 768, 768, 1200}, {1262, 2786, 768, 1262, 1984, 2274},
          {2786, 9728, 768, 3286, -1, 768}, {2786, 2147483647, 768, 3286, 768, 2274},
          {2786, 5900, 3286, 5660, 1774, 2274}, {5900, 2147483647, 3286, 3798, -1, 2274},
          {768, 3798, -1, 1262, 2274, 3248}, {1774, 3798, -1, 768, 3248, 5312},
          {4298, 2147483647, -1, 1262, 4608, 5312}}},
        {1,
         {{-1, 2786, 768, 2147483647, -1, 1200}, {-1, 2786, -1, 2147483647, 1200, 1984},
          {-1, 1262, 768, 1262, 1984, 2274}, {-1, 2786, 1262, 2147483647, 1984, 2274},
          {2786, 5900, 3286, 2147483647, -1, 1774}, {2786, 5900, 5660, 2147483647, 1774, 2274},
          {5900, 2147483647, 3798, 2147483647, -1, 2274}, {-1, 768, -1, 1262, 2274, 3248},
          {-1, 3798, 1262, 2147483647, 2274, 3248}, {-1, 1774, -1, 768, 3248, 5312},
          {-1, 3798, 768, 2147483647, 3248, 5312}, {3798, 4298, 1006, 2147483647, 2274, 5312},
          {4298, 2147483647, 1262, 2147483647, 2274, 5312}, {-1, 2147483647, -1, 2147483647, 5312, 2147483647}}},
        {6,
         {{2786, 4608, -1, 768, -1, 2274}}},
        {10,
         {{6700, 2147483647, -1, 768, -1, 768}}},
        {8,
         {{6700, 2147483647, -1, 768, 768, 2274}}},
        {12,
         {{9728, 2147483647, 768, 3286, -1, 768}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093SixteenRankFP16CommnpusplitMap = {
        {8,
         {{-1, 2274, -1, 1262, -1, 576}, {-1, 2274, -1, 768, 576, 1200},
          {2024, 2274, 6160, 7696, 1624, 2274}, {2274, 2147483647, -1, 1774, -1, 768},
          {2274, 2147483647, -1, 768, 768, 1262}, {2274, 2147483647, -1, 768, 1774, 2274},
          {2274, 3584, 5360, 2147483647, -1, 768}, {-1, 768, 5660, 7696, 2274, 2147483647}}},
        {1,
         {{-1, 2274, 1262, 2147483647, -1, 576}, {-1, 2274, 768, 2147483647, 576, 1200},
          {-1, 2274, -1, 2147483647, 1200, 1624}, {-1, 1518, -1, 2147483647, 1824, 2274},
          {2024, 2274, -1, 6160, 1624, 2274}, {2024, 2274, 7696, 2147483647, 1624, 2274},
          {2274, 2147483647, 1774, 5360, -1, 768}, {2274, 2147483647, 768, 5360, 768, 1262},
          {2274, 2147483647, 768, 5360, 1774, 2274}, {6950, 2147483647, 7696, 2147483647, 1774, 2274},
          {-1, 768, -1, 768, 2274, 4608}, {768, 6450, -1, 768, 2274, 5312},
          {6450, 2147483647, -1, 768, 2274, 5660}}},
        {16,
         {{-1, 1518, -1, 2147483647, 1624, 1824}, {1518, 2024, -1, 2147483647, 1624, 2274},
          {2274, 2147483647, -1, 5360, 1262, 1774}, {3584, 6950, 5360, 2147483647, -1, 768},
          {2274, 6950, 5360, 2147483647, 768, 2274}, {6950, 2147483647, 5360, 2147483647, -1, 1774},
          {6950, 2147483647, 5360, 7696, 1774, 2274}, {-1, 768, -1, 768, 4608, 2147483647},
          {-1, 768, 768, 5660, 2274, 2147483647}, {-1, 768, 7696, 2147483647, 2274, 2147483647},
          {768, 6450, 768, 2147483647, 2274, 5312}, {768, 6450, -1, 2147483647, 5312, 2147483647},
          {6450, 2147483647, -1, 768, 5660, 2147483647}, {6450, 2147483647, 768, 2147483647, 2274, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093SixteenRankFP16UbmovenumMap = {
        {160,
         {{-1, 2274, -1, 768, -1, 1456}, {2274, 2147483647, -1, 768, -1, 2274}}},
        {16,
         {{-1, 2274, 768, 2147483647, -1, 1456}, {-1, 2274, -1, 8704, 1456, 1824},
          {-1, 2274, -1, 2147483647, 1824, 2400}, {1262, 2274, 768, 2147483647, 2400, 3504},
          {2274, 2147483647, 768, 5900, -1, 2274}, {2274, 2147483647, 5900, 2147483647, 1774, 2274},
          {2274, 2147483647, 11744, 2147483647, 2274, 2786}, {2274, 2147483647, -1, 7696, 2786, 3286}}},
        {8,
         {{-1, 2274, 8704, 2147483647, 1456, 1824}, {1262, 2274, 768, 2147483647, 3504, 5552},
          {2274, 2147483647, 768, 2147483647, 3286, 4298}, {768, 1262, 2560, 2147483647, 5552, 6684},
          {1262, 1518, -1, 2560, 5552, 6684}}},
        {18,
         {{-1, 1262, -1, 2147483647, 2400, 2912}, {2274, 2147483647, 5900, 2147483647, -1, 1774}}},
        {14,
         {{-1, 768, -1, 2147483647, 2912, 5552}}},
        {10,
         {{768, 1262, -1, 2147483647, 2912, 5552}, {-1, 768, -1, 2560, 5552, 6684},
          {-1, 768, -1, 1262, 6684, 8704}, {-1, 768, 6656, 2147483647, 8704, 2147483647},
          {768, 1262, -1, 2560, 5552, 6684}, {1262, 1518, 2560, 2147483647, 5552, 6684}}},
        {2,
         {{1262, 2274, -1, 768, 2400, 5552}, {2274, 2147483647, -1, 768, 3286, 5552}}},
        {12,
         {{2274, 2147483647, -1, 11744, 2274, 2786}, {2274, 2147483647, 7696, 2147483647, 2786, 3286},
          {-1, 768, 2560, 2147483647, 5552, 6172}, {-1, 768, 1262, 2147483647, 6684, 8704},
          {-1, 768, -1, 6656, 8704, 2147483647}}},
        {6,
         {{2274, 2786, 768, 2147483647, 4298, 5552}, {768, 1518, -1, 1774, 6684, 2147483647},
          {768, 1518, 5660, 11264, 6684, 2147483647}}},
        {5,
         {{2786, 2147483647, 768, 2147483647, 4298, 5552}, {1518, 3286, -1, 2147483647, 5552, 5872}}},
        {80,
         {{-1, 768, 2560, 2147483647, 6172, 6684}}},
        {4,
         {{768, 1518, 1774, 5660, 6684, 2147483647}, {1518, 3286, -1, 2147483647, 5872, 8958},
          {2786, 3286, 6160, 2147483647, 8958, 2147483647}, {3286, 8958, 1774, 2274, 5552, 2147483647},
          {3286, 8958, 2274, 2147483647, 5552, 7434}, {8958, 9728, 2560, 2147483647, 5552, 2147483647},
          {9728, 2147483647, 9728, 2147483647, 5552, 2147483647}}},
        {3,
         {{768, 1518, 11264, 2147483647, 6684, 2147483647}, {1518, 2786, -1, 2147483647, 8958, 2147483647},
          {2786, 3286, -1, 6160, 8958, 2147483647}, {3286, 8958, -1, 1774, 5552, 2147483647},
          {3286, 8958, 2274, 2147483647, 7434, 2147483647}, {8958, 9728, -1, 2560, 5552, 2147483647},
          {9728, 2147483647, -1, 9728, 5552, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093SixteenRankFP16M0Map = {
        {256,
         {{-1, 2024, -1, 7696, -1, 576}, {-1, 2024, -1, 4608, 576, 1200},
          {768, 2024, -1, 2147483647, 1200, 1518}, {2024, 9728, 768, 2147483647, -1, 1518},
          {9728, 2147483647, 2560, 2147483647, -1, 1518}, {-1, 2147483647, -1, 2274, 5660, 6684},
          {2274, 8958, 2274, 2147483647, 1518, 9728}, {2274, 2147483647, 2274, 11744, 9728, 2147483647}}},
        {128,
         {{-1, 2024, 7696, 2147483647, -1, 576}, {-1, 2024, 4608, 2147483647, 576, 1200},
          {-1, 768, -1, 2147483647, 1200, 1518}, {2024, 2147483647, -1, 768, -1, 1518},
          {9728, 2147483647, 768, 2560, -1, 1518}, {-1, 2147483647, -1, 2274, 1518, 5660},
          {-1, 2147483647, -1, 2274, 6684, 2147483647}, {-1, 2274, 2274, 2147483647, 1518, 2147483647},
          {8958, 2147483647, 2274, 2147483647, 1518, 9728}, {2274, 2147483647, 11744, 2147483647, 9728, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093TwoRankFP16PvalueMap = {
        {3,
         {{-1, 4608, -1, 3584, -1, 1536}}},
        {6,
         {{-1, 4608, 3584, 4608, -1, 1536}, {4608, 6656, 4608, 2147483647, -1, 8704},
          {6656, 2147483647, 4608, 2147483647, -1, 7680}, {6656, 9728, -1, 2560, 9728, 15360},
          {9728, 2147483647, 1280, 2560, 9728, 2147483647}, {3584, 6656, 2560, 3584, 9728, 15360}}},
        {4,
         {{-1, 4608, 4608, 2147483647, -1, 1536}, {-1, 2560, -1, 3584, 1536, 2560},
          {-1, 4608, 3584, 2147483647, 1536, 2560}}},
        {10,
         {{2560, 4608, -1, 3584, 1536, 2560}, {3584, 4608, -1, 2147483647, 2560, 5632},
          {4608, 2147483647, 768, 1280, -1, 4608}, {4608, 2147483647, 1280, 2560, 1536, 2560},
          {-1, 1536, 7168, 2147483647, 9728, 11264}, {-1, 1536, 8704, 2147483647, 11264, 13312},
          {-1, 1536, 7680, 2147483647, 15360, 2147483647}, {1536, 2560, 8704, 2147483647, 11264, 2147483647},
          {4608, 9728, -1, 2560, 15360, 2147483647}}},
        {12,
         {{-1, 1536, -1, 2147483647, 2560, 5632}, {2560, 3584, -1, 2147483647, 2560, 5632},
          {4608, 8704, -1, 768, -1, 9728}, {4608, 2147483647, 768, 1280, 4608, 9728},
          {4608, 2147483647, 1280, 2560, -1, 1536}, {1536, 2560, -1, 2147483647, 9728, 11264},
          {2560, 3584, 7680, 2147483647, 9728, 2147483647}, {3584, 6656, 2560, 3584, 15360, 2147483647},
          {6656, 2147483647, 2560, 3584, 9728, 2147483647}, {3584, 2147483647, 3584, 2147483647, 9728, 2147483647}}},
        {14,
         {{1536, 2560, -1, 2147483647, 2560, 5632}, {-1, 4608, -1, 2147483647, 5632, 9728},
          {8704, 2147483647, -1, 768, -1, 9728}, {4608, 2147483647, 1280, 2560, 2560, 8704},
          {4608, 6656, 2560, 4608, -1, 9728}, {4608, 6656, 4608, 2147483647, 8704, 9728},
          {6656, 2147483647, 4608, 2147483647, 7680, 9728}, {-1, 1536, -1, 7168, 9728, 11264},
          {-1, 1536, -1, 8704, 11264, 13312}, {-1, 1536, -1, 7680, 13312, 2147483647},
          {-1, 1536, 7680, 2147483647, 13312, 15360}, {1536, 2560, -1, 8704, 11264, 2147483647},
          {2560, 3584, -1, 7680, 9728, 2147483647}, {3584, 6656, -1, 2560, 9728, 15360},
          {3584, 4608, -1, 2560, 15360, 2147483647}, {9728, 2147483647, -1, 1280, 9728, 2147483647}}},
        {8,
         {{4608, 2147483647, 1280, 2560, 8704, 9728}, {6656, 2147483647, 2560, 4608, -1, 9728}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093TwoRankFP16M0Map = {
        {128,
         {{-1, 3584, -1, 2147483647, -1, 2560}, {-1, 3584, -1, 8704, 2560, 3584},
          {3584, 2147483647, -1, 2147483647, -1, 3584}, {4608, 2147483647, -1, 7680, 3584, 2147483647},
          {3584, 2147483647, 7680, 2147483647, 3584, 2147483647}}},
        {256,
         {{-1, 3584, 8704, 2147483647, 2560, 3584}, {-1, 4608, -1, 7680, 3584, 2147483647},
          {-1, 3584, 7680, 2147483647, 3584, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgatherV291093TwoRankFP16UbmovenumMap = {
        {3,
         {{-1, 4608, -1, 768, -1, 1536}, {-1, 4608, 2560, 2147483647, 5632, 7680},
          {-1, 1536, -1, 2147483647, 7680, 8704}, {4608, 7680, -1, 2147483647, -1, 4608},
          {4608, 7680, 7680, 2147483647, 4608, 8704}, {7680, 2147483647, -1, 2147483647, -1, 1536},
          {7680, 2147483647, 6656, 2147483647, 1536, 8704}}},
        {4,
         {{-1, 4608, 768, 2147483647, -1, 1536}, {9728, 2147483647, -1, 768, 8704, 18432}}},
        {6,
         {{-1, 4608, -1, 2147483647, 1536, 5632}, {-1, 4608, -1, 2560, 5632, 7680},
          {1536, 4608, -1, 768, 8704, 19456}, {9728, 2147483647, -1, 768, 18432, 2147483647}}},
        {2,
         {{1536, 4608, -1, 2147483647, 7680, 8704}, {4608, 7680, -1, 7680, 4608, 8704},
          {7680, 2147483647, -1, 6656, 1536, 8704}, {4608, 9728, -1, 768, 8704, 2147483647},
          {-1, 2147483647, 768, 2147483647, 8704, 2147483647}}},
        {8,
         {{-1, 1536, -1, 768, 8704, 13312}}},
        {10,
         {{-1, 1536, -1, 768, 13312, 2147483647}}},
        {12,
         {{1536, 4608, -1, 768, 19456, 2147483647}}}
    };

    void AllGatherV2NPU91093EightRankFP16Tiling(CoCTilingData &cocTilingData)
    {
        std::map<int*, TilingValue> tilingParamMap = {
            {&cocTilingData.m0,
             {ALLGATHERV2_91093_EIGHT_RANK_FP16_M0_DEFAULT,
              g_allgatherV291093EightRankFP16M0Map}},
            {&cocTilingData.commDataSplit,
             {ALLGATHERV2_91093_EIGHT_RANK_FP16_COMMDATASPLIT_DEFAULT,
              g_allgatherV291093EightRankFP16CommdatasplitMap}},
            {&cocTilingData.ubMoveNum,
             {ALLGATHERV2_91093_EIGHT_RANK_FP16_UBMOVENUM_DEFAULT,
              g_allgatherV291093EightRankFP16UbmovenumMap}},
            {&cocTilingData.pValue,
             {ALLGATHERV2_91093_EIGHT_RANK_FP16_PVALUE_DEFAULT,
              g_allgatherV291093EightRankFP16PvalueMap}},
            {&cocTilingData.swizzlDirect, {SWIZZLE_DIRECT_ONE}},
            {&cocTilingData.swizzlCount, {SWIZZLE_COUNT_FOUR}}
        };
        SetTilingParam(cocTilingData, tilingParamMap);

        cocTilingData.commDirect =
                cocTilingData.commDataSplit == COMMDATASPLIT_ONE ? COMM_DATA_DIRECT : COMM_NPU_DIRECT;
        cocTilingData.commNpuSplit =
                cocTilingData.commDataSplit == COMMDATASPLIT_ONE ? cocTilingData.rankSize : COMMNPUSPLIT_ONE;
        cocTilingData.lenPerLoop = cocTilingData.ubMoveNum * cocTilingData.commDataSplit;

        DealTilingParamByBuffSize(cocTilingData);
    }

    void AllGatherV2NPU91093SixteenRankFP16Tiling(CoCTilingData &cocTilingData)
    {
        std::map<int*, TilingValue> tilingParamMap = {
            {&cocTilingData.m0,
             {ALLGATHERV2_91093_SIXTEEN_RANK_FP16_M0_DEFAULT,
              g_allgatherV291093SixteenRankFP16M0Map}},
            {&cocTilingData.commNpuSplit,
             {ALLGATHERV2_91093_SIXTEEN_RANK_FP16_COMMNPUSPLIT_DEFAULT,
              g_allgatherV291093SixteenRankFP16CommnpusplitMap}},
            {&cocTilingData.ubMoveNum,
             {ALLGATHERV2_91093_SIXTEEN_RANK_FP16_UBMOVENUM_DEFAULT,
              g_allgatherV291093SixteenRankFP16UbmovenumMap}},
            {&cocTilingData.pValue,
             {ALLGATHERV2_91093_SIXTEEN_RANK_FP16_PVALUE_DEFAULT,
              g_allgatherV291093SixteenRankFP16PvalueMap}},
            {&cocTilingData.swizzlDirect, {SWIZZLE_DIRECT_ONE}},
            {&cocTilingData.swizzlCount, {SWIZZLE_COUNT_FOUR}}
        };
        SetTilingParam(cocTilingData, tilingParamMap);

        cocTilingData.commDirect =
                cocTilingData.commNpuSplit <= COMMNPUSPLIT_EIGHT ? COMM_NPU_DIRECT : COMM_DATA_DIRECT;
        cocTilingData.commDataSplit =
                cocTilingData.commNpuSplit > COMMNPUSPLIT_ONE ? COMMDATASPLIT_ONE : COMMDATASPLIT_EIGHT;
        cocTilingData.lenPerLoop = cocTilingData.ubMoveNum * cocTilingData.commDataSplit;

        DealTilingParamByBuffSize(cocTilingData);
    }

    void AllGatherV2NPU91093TwoRankFP16Tiling(CoCTilingData &cocTilingData)
    {
        std::map<int*, TilingValue> TilingParamMap = {
            {&cocTilingData.pValue,
             {ALLGATHERV2_91093_TWO_RANK_FP16_PVALUE_DEFAULT,
              g_allgatherV291093TwoRankFP16PvalueMap}},
            {&cocTilingData.m0,
             {ALLGATHERV2_91093_TWO_RANK_FP16_M0_DEFAULT,
              g_allgatherV291093TwoRankFP16M0Map}},
            {&cocTilingData.ubMoveNum,
             {ALLGATHERV2_91093_TWO_RANK_FP16_UBMOVENUM_DEFAULT,
              g_allgatherV291093TwoRankFP16UbmovenumMap}},
            {&cocTilingData.swizzlDirect, {SWIZZLE_DIRECT_ONE}},
            {&cocTilingData.swizzlCount, {DEFAULT_SWIZZLE_COUNT}},
            {&cocTilingData.commDirect, {COMM_DATA_DIRECT}},
            {&cocTilingData.commNpuSplit, {COMMNPUSPLIT_ONE}},
            {&cocTilingData.commDataSplit, {COMMDATASPLIT_SIXTEEN}}
        };
        SetTilingParam(cocTilingData, TilingParamMap);

        cocTilingData.lenPerLoop = cocTilingData.ubMoveNum * cocTilingData.commDataSplit;

        DealTilingParamByBuffSize(cocTilingData);
    }
}